<template>
	<view>
		<cu-custom bgColor="" :isBack="true">
			<block slot="back">返回</block>
			<block slot="content">绑定手机</block>
		</cu-custom>
		<view class="bg-white round2 shadow-blur lh2 bdbda">
			<view class="flrc padtb3 padlr5">
				<view class="padr5">手机号:</view>
				<view class="flex1">
					<input type="number" v-model="phone" placeholder="请输入手机号">
				</view>
			</view>
		</view>
		<!-- <view class="text-red tac">
			手机号只能修改一次，请认真核对，如有错误请联系管理员修改。
		</view> -->
		<view class="mar3"> 
			<view class="cu-btn bg-gradual-orange tac round w100 fs12 pad5 ripple" @click="savePhone">保存</view>
		</view>
	</view>
</template>

<script>
	import api from '../../../static/js/api.js'
	import com from '../../../static/js/com.js'
	import win from '../../../static/js/win.js'
	export default {
		data() {
			return {
				phone:''
			}
		},
		methods: {
			savePhone(){
				if(com.isTrue(this.phone)){
					api.post('/api/save/user',{phone:this.phone},function(res){
						console.log(res)
						if(res.s == 1){
							win.goback()
						}
					})
				}else{
					com.showToast('请输入手机号')
				}
			}
		},
		onLoad() {
			let _this = this
			api.get('/api/get_user_info',{},function(res){
				if(com.isTrue( res.d.user.phone)){
					_this.phone = res.d.user.phone
				}
			})
			
		}
	}
</script>

<style>

</style>
